3.2456 \(\int \frac{\left (a+b x^n\right )^2}{x^2} \, dx\)

Optimal. Leaf size=44 \[ -\frac{a^2}{x}-\frac{2 a b x^{n-1}}{1-n}-\frac{b^2 x^{2 n-1}}{1-2 n} \]

[Out]

-(a^2/x) - (2*a*b*x^(-1 + n))/(1 - n) - (b^2*x^(-1 + 2*n))/(1 - 2*n)

_______________________________________________________________________________________

Rubi [A]  time = 0.061702, antiderivative size = 44, normalized size of antiderivative = 1., number of steps used = 2, number of rules used = 1, integrand size = 13, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.077 \[ -\frac{a^2}{x}-\frac{2 a b x^{n-1}}{1-n}-\frac{b^2 x^{2 n-1}}{1-2 n} \]

Antiderivative was successfully verified.

[In]  Int[(a + b*x^n)^2/x^2,x]

[Out]

-(a^2/x) - (2*a*b*x^(-1 + n))/(1 - n) - (b^2*x^(-1 + 2*n))/(1 - 2*n)

_______________________________________________________________________________________

Rubi in Sympy [A]  time = 8.9575, size = 34, normalized size = 0.77 \[ - \frac{a^{2}}{x} - \frac{2 a b x^{n - 1}}{- n + 1} - \frac{b^{2} x^{2 n - 1}}{- 2 n + 1} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  rubi_integrate((a+b*x**n)**2/x**2,x)

[Out]

-a**2/x - 2*a*b*x**(n - 1)/(-n + 1) - b**2*x**(2*n - 1)/(-2*n + 1)

_______________________________________________________________________________________

Mathematica [A]  time = 0.0489686, size = 38, normalized size = 0.86 \[ \frac{-a^2+\frac{2 a b x^n}{n-1}+\frac{b^2 x^{2 n}}{2 n-1}}{x} \]

Antiderivative was successfully verified.

[In]  Integrate[(a + b*x^n)^2/x^2,x]

[Out]

(-a^2 + (2*a*b*x^n)/(-1 + n) + (b^2*x^(2*n))/(-1 + 2*n))/x

_______________________________________________________________________________________

Maple [A]  time = 0.016, size = 43, normalized size = 1. \[{\frac{1}{x} \left ({\frac{{b}^{2} \left ({{\rm e}^{n\ln \left ( x \right ) }} \right ) ^{2}}{-1+2\,n}}-{a}^{2}+2\,{\frac{ab{{\rm e}^{n\ln \left ( x \right ) }}}{-1+n}} \right ) } \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  int((a+b*x^n)^2/x^2,x)

[Out]

(b^2/(-1+2*n)*exp(n*ln(x))^2-a^2+2*a*b/(-1+n)*exp(n*ln(x)))/x

_______________________________________________________________________________________

Maxima [F]  time = 0., size = 0, normalized size = 0. \[ \text{Exception raised: ValueError} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate((b*x^n + a)^2/x^2,x, algorithm="maxima")

[Out]

Exception raised: ValueError

_______________________________________________________________________________________

Fricas [A]  time = 0.241311, size = 92, normalized size = 2.09 \[ -\frac{2 \, a^{2} n^{2} - 3 \, a^{2} n + a^{2} -{\left (b^{2} n - b^{2}\right )} x^{2 \, n} - 2 \,{\left (2 \, a b n - a b\right )} x^{n}}{{\left (2 \, n^{2} - 3 \, n + 1\right )} x} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate((b*x^n + a)^2/x^2,x, algorithm="fricas")

[Out]

-(2*a^2*n^2 - 3*a^2*n + a^2 - (b^2*n - b^2)*x^(2*n) - 2*(2*a*b*n - a*b)*x^n)/((2
*n^2 - 3*n + 1)*x)

_______________________________________________________________________________________

Sympy [A]  time = 2.46162, size = 190, normalized size = 4.32 \[ \begin{cases} - \frac{a^{2}}{x} - \frac{4 a b}{\sqrt{x}} + b^{2} \log{\left (x \right )} & \text{for}\: n = \frac{1}{2} \\- \frac{a^{2}}{x} + 2 a b \log{\left (x \right )} + b^{2} x & \text{for}\: n = 1 \\- \frac{2 a^{2} n^{2}}{2 n^{2} x - 3 n x + x} + \frac{3 a^{2} n}{2 n^{2} x - 3 n x + x} - \frac{a^{2}}{2 n^{2} x - 3 n x + x} + \frac{4 a b n x^{n}}{2 n^{2} x - 3 n x + x} - \frac{2 a b x^{n}}{2 n^{2} x - 3 n x + x} + \frac{b^{2} n x^{2 n}}{2 n^{2} x - 3 n x + x} - \frac{b^{2} x^{2 n}}{2 n^{2} x - 3 n x + x} & \text{otherwise} \end{cases} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate((a+b*x**n)**2/x**2,x)

[Out]

Piecewise((-a**2/x - 4*a*b/sqrt(x) + b**2*log(x), Eq(n, 1/2)), (-a**2/x + 2*a*b*
log(x) + b**2*x, Eq(n, 1)), (-2*a**2*n**2/(2*n**2*x - 3*n*x + x) + 3*a**2*n/(2*n
**2*x - 3*n*x + x) - a**2/(2*n**2*x - 3*n*x + x) + 4*a*b*n*x**n/(2*n**2*x - 3*n*
x + x) - 2*a*b*x**n/(2*n**2*x - 3*n*x + x) + b**2*n*x**(2*n)/(2*n**2*x - 3*n*x +
 x) - b**2*x**(2*n)/(2*n**2*x - 3*n*x + x), True))

_______________________________________________________________________________________

GIAC/XCAS [F]  time = 0., size = 0, normalized size = 0. \[ \int \frac{{\left (b x^{n} + a\right )}^{2}}{x^{2}}\,{d x} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate((b*x^n + a)^2/x^2,x, algorithm="giac")

[Out]

integrate((b*x^n + a)^2/x^2, x)